package com.itheima.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.itheima.anno.State;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.URL;

import java.time.LocalDateTime;

@Data
public class Article {
    @NotNull(groups = {Update.class})
    private Integer id;//主键ID

    @NotEmpty (message = "文章标题不能为空",groups = {Add.class,Update.class})
    private String title;//文章标题

    @NotEmpty (message = "文章内容不能为空",groups = {Add.class,Update.class})
    private String content;//文章内容

    @URL
    @NotEmpty (message = "文章封面不能为空",groups = {Add.class,Update.class})
    private String coverImg;//封面图像

    @State
//    @NotEmpty (message = "文章状态不能为空",groups = {Add.class,Update.class})
    private String state;//发布状态 已发布|草稿

    @NotNull
    private Integer categoryId;//文章分类id

    private String categoryName;

    private Integer createUser;//创建人ID

    @JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;//创建时间
    @JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime updateTime;//更新时间

    public interface Add{}
    public interface Update{}

}
